#include "drv_led.h"
#include "drv_systick.h"
void drv_led_init(void)
{
    RCC->AHB1ENR |=0x04;
    GPIOC->MODER &=~(0X11<<6);
    GPIOC->MODER |=0X01<<6;
    GPIOC->MODER &=~(0X11<<8);
    GPIOC->MODER |=0X01<<8;
    GPIOC->MODER &=~(0X11<<26);
    GPIOC->MODER |=0X01<<26;
    GPIOC->ODR &=~(0X01<<3);
    GPIOC->ODR &=~(0X01<<4);
    GPIOC->ODR &=~(0X01<<13);
}

void drv_led_open(void)
{
    GPIOC->ODR |=0X01<<3;
    GPIOC->ODR |=0X01<<4;
    GPIOC->ODR |=0X01<<13;
}

void drv_led_close(void)
{
    GPIOC->ODR &=~(0X01<<3);
    GPIOC->ODR &=~(0X01<<4);
    GPIOC->ODR &=~(0X01<<13);
}

void waterfall_light(void)
{
	while(1)
	{
        
        // 2. PC4点亮 -> 延时 -> 熄灭
        GPIOC->ODR |= 0x01<<3;  // 点亮
        drv_systick_ms(1000);        // 延时
        GPIOC->ODR &= ~(0x01<<3);   // 熄灭
        
        // 3. PC3点亮 -> 延时 -> 熄灭
        GPIOC->ODR |= 0x01<<4;  // 点亮
        drv_systick_ms(1000);        // 延时
        GPIOC->ODR &= ~(0x01<<4);   // 熄灭
        
        // 4. PC13点亮 -> 延时 -> 熄灭
        GPIOC->ODR |= 0x01<<13; // 点亮
        drv_systick_ms(1000);        // 延时
        GPIOC->ODR &= ~(0x01<<13);  // 熄灭
	}
}


